CREATE TABLE [dbo].[TTCNTA_BNCO]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_CNTA_EMPR] [dbo].[TD_VC_020_CNTA] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NULL CONSTRAINT [DF__TTCNTA_BN__NU_AN__0EF836A4] DEFAULT (datepart(year,getdate())),
[CO_MONE] [dbo].[TD_VC_003] NOT NULL,
[CO_BANC] [dbo].[TD_VC_003] NULL,
[NU_AGEN] [dbo].[TD_VC_003] NULL,
[NO_AGEN] [dbo].[TD_VC_050] NULL,
[NO_DIRE] [dbo].[TD_VC_050] NULL,
[NU_TLFN] [dbo].[TD_VC_020] NULL,
[NU_FAXE] [dbo].[TD_VC_020] NULL,
[DE_PROD] [dbo].[TD_VC_050] NULL,
[NU_CNTA_CNTE] [dbo].[TD_VC_050] NULL,
[ST_GENE] [dbo].[TD_VC_003] NOT NULL,
[NU_ULTI_CHEQ] [int] NOT NULL,
[IM_ULTI_REAL] [dbo].[TD_NU_016_004] NULL CONSTRAINT [DF__TTCNTA_BN__IM_UL__10E07F16] DEFAULT ((0)),
[FE_IMPO_REAL] [dbo].[TD_DT_001] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTCNTA_BN__FE_US__12C8C788] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTCNTA_BN__FE_US__13BCEBC1] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTCNTA_BNCO] ADD CONSTRAINT [CK__TTCNTA_BN__CO_CN__0E04126B] CHECK (([CO_CNTA_EMPR]>='0' AND [CO_CNTA_EMPR]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TTCNTA_BNCO] ADD CONSTRAINT [CK__TTCNTA_BN__IM_UL__11D4A34F] CHECK (([IM_ULTI_REAL]>=(0)))
GO
ALTER TABLE [dbo].[TTCNTA_BNCO] ADD CONSTRAINT [CK__TTCNTA_BN__NU_AN__0FEC5ADD] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TTCNTA_BNCO] ADD CONSTRAINT [TTCNTA_BNC_20786304481] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_CNTA_EMPR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTCNTA_BNCO] ADD CONSTRAINT [FK1_TMPLAN_ANNO_A_TTCNTA_BNCO] FOREIGN KEY ([CO_EMPR], [CO_CNTA_EMPR]) REFERENCES [dbo].[TMPLAN_ANNO] ([CO_EMPR], [CO_CNTA_EMPR])
GO
